<?php error_reporting(E_ALL ^ E_NOTICE);ob_start();session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}
	include "connection_open.php";
		$colors=$_REQUEST['color'];
		$color=explode('-',$colors);
		$sizes=$_REQUEST['size'];
		$size=explode('-',$sizes);
	
		for($i=0;$i<count($color);$i++)
		{
			$del=mysql_query("DELETE FROM product_color WHERE id_color='".$color[$i]."' and id_product='".$_REQUEST['product']."'");
//echo "DELETE FROM product_color WHERE id_color='".$color[$i]."' and id_product='".$_REQUEST['product']."'";
		}
		for($j=0;$j<count($size);$j++)
		{
			$del_size=mysql_query("DELETE FROM product_size WHERE id_size='".$size[$j]."' and id_product='".$_REQUEST['product']."'");	
			//echo "DELETE FROM product_size WHERE id_size='".$size[$j]."' and id_product='".$_REQUEST['product']."'";
		}
		if(isset($_REQUEST['outofstock']))
		{
			$res=mysql_query("UPDATE product SET quantity='0' WHERE id='".$_REQUEST['product']."'");
		}
		$row_rate=mysql_query('select * from rate');
		$result_rate=mysql_fetch_row($row_rate);
		$row_commission=mysql_query('select c.commission,c.sale_off from product p, category c where p.id_category=c.id and p.id="'.$_REQUEST['product'].'"');
		$result_commission=mysql_fetch_array($row_commission);
		$priceVN=str_replace(",","",$_REQUEST['newprice'])*$result_rate[1]*((100+$result_commission['commission']-$result_commission['sale_off'])/100);
		$writer=mysql_query("UPDATE product SET updater='".$_SESSION['accountshopping'][1]."', price='".str_replace(",","",$_REQUEST['newprice'])."', priceVN='$priceVN', price_new='".str_replace(",","",$_REQUEST['newprice'])."', updater_time=NOW(), price_result=1 WHERE id='".$_REQUEST['product']."'");		
	
		$list_product=$_SESSION['product_next'];
		for($j=0;$j<count($list_product);$j++)
		{
			if($list_product[$j][1]==$_REQUEST['product'])
			echo $list_product[$j+1][1];
		}
	
	include "connection_close.php";
?>